/**
 * Copyright (C) 2011 Denatics Development
 *
 * Programmed by David Tiersch <dtiersch@denatics.com>
 *
 * This file is part of B0mberman.
 *
 * B0mberman is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * B0mberman is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with B0mberman. If not, see <http://www.gnu.org/licenses/>.
 */
package com.denatics.bomberman.sprites;

/**
 * Skeleton for all Sprites in the Game-World.
 *
 * @author David Tiersch <dtiersch@denatics.com>
 */
public abstract class Sprite {

    /**
     * Indicates if the Sprite blocks other Objects.
     */
    private boolean solid = false;

    /**
     * Offset on the x-Axis in n/Config.MOVEMENT_SPEED tiles.
     */
    private int xOffset = 0;

    /**
     * Offset on the y-Axis in n/Config.MOVEMENT_SPEED tiles.
     */
    private int yOffset = 0;

    /**
     * Takes counter to the transparent area.
     */
    private int padding = 0;

    /**
     * Indicates the Type of the Sprite.
     *
     * @return Type of the Sprite
     */
    public abstract SpriteType getType();

    /**
     * Returns the position of the graphics of this Sprite in the Sprites-File.
     *
     * @return position of the Texture
     */
    public abstract int[] getTexPosition();

    /**
     * Returns the Offset of the sprite in respect to the tile. The values are
     * given in n/Config.MOVEMENT_SPEED tiles.
     *
     * @return offset
     */
    public final int[] getOffset() {
        int[] offset = {xOffset, yOffset };
        return offset;
    }

    /**
     * Sets the Offset to new values.
     *
     * @param offX
     *            new Offset on the x-axis
     * @param offY
     *            new Offset on the y-axis
     */
    public final void setOffset(final int offX, final int offY) {
        this.xOffset = offX;
        this.yOffset = offY;
    }

    /**
     * Shows whether this Sprite blocks other Objects.
     *
     * @return true, if other Objects are being blocked.
     */
    public final boolean isSolid() {
        return this.solid;
    }

    /**
     * Changes the Solidness.
     *
     * @param newValue
     *            indicates if the Entity blocks other Entities
     */
    protected final void setSolid(final boolean newValue) {
        this.solid = newValue;
    }

    /**
     * Changes the Padding area of the Sprite.
     *
     * @param newPadding
     *            space around the Sprite in which the object is not solid
     */
    protected final void setPadding(final int newPadding) {
        this.padding = newPadding;
    }

    /**
     * Get the Padding area of the Sprite.
     *
     * @return space around the Sprite in which the object is not solid
     */
    public final int getPadding() {
        return this.padding;
    }
}
